
<!--A Design by W3layouts
Author: W3layout
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE html>
<head>
    <title>宠物订单</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Visitors Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
    <!-- bootstrap-css -->
    <link rel="stylesheet" href="../css/bootstrap.min.css" >
    <!-- //bootstrap-css -->
    <!-- Custom CSS -->
    <link href="../css/style.css" rel='stylesheet' type='text/css' />
    <link href="../css/style-responsive.css" rel="stylesheet"/>
    <!-- font CSS -->
    <link href='//fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <!-- font-awesome icons -->
    <link href="../css/font-awesome.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">
    <!-- //font-awesome icons -->
    <script src="../js/jquery2.0.3.min.js"></script>
</head>
<style>
    /*.d1 {background: #A3D0C3;}*/
    td{
        height: 50px;
    }
    .d1 input {
        width: 300px;
        height: 42px;
        margin-left: 30px;
        padding-left: 10px;
        border: 2px solid #7BA7AB;
        border-radius: 5px;
        outline: none;
        background: #F9F0DA;
        color: #9E9C9C;
    }
    .d1 button {
        top: 0;
        right: 0px;
        width: 42px;
        height: 42px;
        border: none;
        background: #7BA7AB;
        border-radius: 0 5px 5px 0;
        cursor: pointer;
    }
    .d1 button:before {
        content: "\f002";
        font-family: FontAwesome;
        font-size: 16px;
        color: #F9F0DA;
    }
    .footer{
        position: fixed;
        bottom: 0;
    }
    img{
        width: 100px;
        height: 100px;
    }
    #text{border-radius: 20px;}
    .user{color: white; border-radius: 10px;height: 30px;width:100px;text-align: center;line-height: 30px;margin-left: 1185px}
</style>
<script>
    var pageNo=1;
    var pageSize=5;
    var currpageInfo;
    $(document).ready(function () {
        getAllFosterOrder();
        var username = null;
        $("[name=firstPage]").click(function(){
            if(pageNo<=1){
                alert("已经是第一页了...");
                return;
            }else{
                pageNo=1;
                getAllFosterOrder(username);
            }
        })
        $("[name=prevPage]").click(function(){
            if(pageNo<=1){
                alert("已经是第一页了...");
                return;
            }else{
                pageNo=pageNo-1;
                getAllFosterOrder(username);
            }
        })
        $("[name=sufPage]").click(function(){
            if(pageNo>=currpageInfo.pages){
                alert("已经是最后一页了...");
                return;
            }else{
                pageNo=pageNo+1;
                getAllFosterOrder(username);
            }
        })
        $("[name=lastPage]").click(function(){
            if(pageNo>=currpageInfo.pages){
                alert("已经是最后一页了...");
                return;
            }else{
                pageNo=currpageInfo.pages;
                getAllFosterOrder(username);
            }
        })
        $("[name=query]").click(function () {
            var content = $("[name=seach]").val();
            if(content==""||content==null){
                username = null;
                getAllFosterOrder(username);
            }else{
                username = content;
                getAllFosterOrder(username);
            }
        })

    })
    function del(id) {
        if(confirm("您要删除此条订单吗?")){
            $.ajax({
                url:'/productOrder/del/'+id,
                success:function (result) {
                    if(result>0){
                        alert("删除成功！");
                        alert(pageNo);

                        getAllFosterOrder();
                        /*$("#tr"+id).remove();*/
                    }else{
                        alert("删除失败，请稍后再试...");
                    }
                }
            })
        }else{
            return;
        }
    }
    function changestatus(id) {
        $.ajax({
            url:'/productOrder/update/'+id,
            success:function (result) {
                if(result>0){
                    alert("受理成功...");
                    getAllFosterOrder();
                }else{
                    alert("受理失败...");
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest.status);
                alert(XMLHttpRequest.readyState);
                alert(textStatus);
            }
        })
    }
    function getAllFosterOrder(username){
        $("table tr:gt(0)").remove();
        if(username==null){
            $.ajax({
                url:'/fosterOrder/getAllFosterOrderORByUsername',
                data:"pageNo="+pageNo+"&pageSize="+pageSize,
                success:function (resultList) {
                    currpageInfo = resultList;
                    for (var i = 0; i < resultList.list.length; i++) {
                        var $tr=$("<tr></tr>");
                        //var usernameTd=$("<td align='center'>"+resultList.list[i].user1.username+"</td>");
                        //var phoneTd=$("<td align='center'>"+resultList.list[i].user1.phone+"</td>");
                        var breedTd=$("<td align='center'>"+resultList.list[i].breed+"</td>");
                        var numberTd=$("<td align='center'>"+resultList.list[i].number+"</td>");
                        var addressTd=$("<td align='center'>"+resultList.list[i].address+"</td>");
                        var contactTd=$("<td align='center'>"+resultList.list[i].contact+"</td>");
                        var creatTimeTd=$("<td align='center'>"+resultList.list[i].creatTime+"</td>");
                        var fristTimeTd=$("<td align='center'>"+resultList.list[i].fristTime+"</td>");
                        var lastTimeTd=$("<td align='center'>"+resultList.list[i].lastTime+"</td>");
                        var priceTd=$("<td align='center'>"+resultList.list[i].price+"</td>");
                            if(resultList.list[i].status==1){
                                status = "已受理";
                            }else{
                                status = "未受理";
                            }
                            var statusTd=$("<td align='center'><a href='javascript:void(0)' onclick='changestatus("+resultList.list[i].id+")'>["+status+"]</a></td>");
                            var tools=$("<td align='center'><a href='javascript:void(0)' onclick='del("+resultList.list[i].id+")'>删除</a></td>");
                            $tr./*append(usernameTd).append(phoneTd).*/append(breedTd).append(numberTd).append(addressTd).append(contactTd).append(creatTimeTd).append(fristTimeTd).append(lastTimeTd).append(priceTd).append(statusTd).append(tools);
                            $("table").append($tr);

                    }
                    $("[name=currpage]").text(pageNo);
                    $("[name=totalpage]").text(resultList.pages);
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status);
                    alert(XMLHttpRequest.readyState);
                    alert(textStatus);
                }
            })
        }else{
            $.ajax({
                url:'/fosterOrder/getAllFosterOrderORByUsername',
                data:"pageNo="+pageNo+"&pageSize="+pageSize+"&username="+username,
                success:function (resultList) {
                    currpageInfo = resultList;
                    for (var i = 0; i < resultList.list.length; i++) {
                        var $tr=$("<tr></tr>");
                        //var usernameTd=$("<td align='center'>"+resultList.list[i].username+"</td>");
                        var phoneTd=$("<td align='center'>"+resultList.list[i].phone+"</td>");
                        var breedTd=$("<td align='center'>"+resultList.list[i].breed+"</td>");
                        var numberTd=$("<td align='center'>"+resultList.list[i].number+"</td>");
                        var addressTd=$("<td align='center'>"+resultList.list[i].address+"</td>");
                        var contactTd=$("<td align='center'>"+resultList.list[i].contact+"</td>");
                        var creatTimeTd=$("<td align='center'>"+resultList.list[i].creatTime+"</td>");
                        var fristTimeTd=$("<td align='center'>"+resultList.list[i].fristTime+"</td>");
                        var lastTimeTd=$("<td align='center'>"+resultList.list[i].lastTime+"</td>");
                        var priceTd=$("<td align='center'>"+resultList.list[i].price+"</td>");
                        if(resultList.list[i].status==1){
                            status = "已受理";
                        }else{
                            status = "未受理";
                        }
                        var statusTd=$("<td align='center'><a href='javascript:void(0)' onclick='changestatus("+resultList.list[i].id+")'>["+status+"]</a></td>");
                        var tools=$("<td align='center'><a href='javascript:void(0)' onclick='del("+resultList.list[i].id+")'>删除</a></td>");
                        $tr./*append(usernameTd).append(phoneTd).*/append(breedTd).append(numberTd).append(addressTd).append(contactTd).append(creatTimeTd).append(fristTimeTd).append(lastTimeTd).append(priceTd).append(statusTd).append(tools);
                        $("table").append($tr);

                    }
                    $("[name=currpage]").text(pageNo);
                    $("[name=totalpage]").text(resultList.pages);
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest.status);
                    alert(XMLHttpRequest.readyState);
                    alert(textStatus);
                }
            })
        }
    }
</script>
<body>
<section id="container">
    <!--header start-->
    <header class="header fixed-top clearfix">
        <div class="brand">
            <a href="index.html" class="logo">
                后台管理系统
            </a>
        </div>
        <div>
            <span class="user" style="margin-top: 10px;margin-top: 10px">欢迎:admin
                <!--<a style="color:black;float: right;margin-right: 20px;">退出系统</a>-->
            </span>

        </div>
    </header>
    <!--header end-->
    <!--sidebar start-->
    <aside>
        <div id="sidebar" class="nav-collapse">
            <div class="leftside-navigation">
                <ul class="sidebar-menu" id="nav-accordion">
                    <li>
                        <a class="active" href="index.html">
                            <i class="fa fa-dashboard"></i>
                            <span>商品上下架</span>
                        </a>
                    </li>

                    <li class="sub-menu">
                        <a href="javascript:;">
                            <i class="fa fa-book"></i>
                            <span>订单管理系统</span>
                        </a>
                        <ul class="sub">
                            <li><a href="petOrder.html">宠物订单</a></li>
                            <li><a href="productOrder.html">商品订单</a></li>
                            <li><a href="fosterOrder.html">寄养订单</a></li>
                            <li><a href="serviceOrder.html">服务订单</a></li>
                        </ul>
                    </li>
                    <li>
                        <a href="fontawesome.html">
                            <i class="fa fa-bullhorn"></i>
                            <span>权限管理系统</span>
                        </a>
                        <ul class="sub">
                            <li><a href="member_management.html">会员</a></li>
                            <li><a href="Administrator.html">管理员</a></li>
                        </ul>
                    </li>
                    <li class="sub-menu">
                        <a href="javascript:;">
                            <i class="fa fa-th"></i>
                            <span>积分管理系统</span>
                        </a>
                    </li>
                    <li class="sub-menu">
                        <a href="javascript:;">
                            <i class="fa fa-tasks"></i>
                            <span>我的报表</span>
                        </a>
                        <ul class="sub">
                            <li><a href="year_statement.html">年度报表</a></li>
                            <li><a href="quarter_statement.html">季度报表</a></li>
                            <li><a href="month_statement.html">月度报表</a></li>
                            <li><a href="day_statement.html">每日报表</a></li>
                        </ul>
                    </li>
                    <li class="sub-menu">
                        <a href="javascript:;">
                            <i class="fa fa-glass"></i>
                            <span>Extra</span>
                        </a>
                        <ul class="sub">
                            <li><a href="gallery.html">Gallery</a></li>
                            <li><a href="404.html">404 Error</a></li>
                            <li><a href="registration.html">Registration</a></li>
                        </ul>
                    </li>
                    <li>
                        <a href="login.html">
                            <i class="fa fa-user"></i>
                            <span>注销</span>
                        </a>
                    </li>
                </ul>            </div>
        </div>
    </aside>
    <!--sidebar end-->
    <!--main content start-->
    <section id="main-content">
        <section class="wrapper">
            <div class="typo-agile">
                <div class="d1" style="width: 500px">
                    请输入用户名:<input name="seach" type="text" placeholder="">
                    <button name="query"></button>
                </div>
                <table border="1" style="width: 100%;margin-top: 10px">
                    <tr>
                        <!--<th>用户名</th>
                        <th>手机号</th>-->
                        <th>宠物种类</th>
                        <th>寄养数量</th>
                        <th>用户地址</th>
                        <th>寄养备注</th>
                        <th>下单时间</th>
                        <th>寄养开始时间</th>
                        <th>寄养结束时间</th>
                        <th>寄养总价</th>
                        <th>订单状态</th>
                        <th>操作</th>
                    </tr>
                </table>
                <div style="padding-left: 900px;padding-top: 20px">
                <a href="javascript:;" name="firstPage">首页</a>
                <a href="javascript:;" name="prevPage">上页</a>
                <a href="javascript:;" name="sufPage">下页</a>
                <a href="javascript:;" name="lastPage">末页</a>
                第<span name="currpage"></span>页/共<span name="totalpage"></span>页</div>
            </div>
        </section>
        <!-- footer -->
        <div class="footer" style="width: 100%;height: 50px">
            <div class="wthree-copyright" style="padding-left: 450px">
                <p>版权所有xxxxxxxxxxxxxxxxxxxxxxxxx</p>
            </div>
        </div>
        <!-- / footer -->
    </section>

    <!--main content end-->
</section>
<script src="../js/bootstrap.js"></script>
<script src="../js/jquery.dcjqaccordion.2.7.js"></script>
<script src="../js/scripts.js"></script>
<script src="../js/jquery.slimscroll.js"></script>
<script src="../js/jquery.nicescroll.js"></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/flot-chart/excanvas.min.js"></script><![endif]-->
<script src="../js/jquery.scrollTo.js"></script>
</body>
</html>
